<script setup lang="ts">
import { api, api_url } from '@/api/api'
import { ref, onBeforeMount, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import type {
  EditCompare,
  EditFacility,
  EditHuman,
  Facility,
  Human,
  Parameter,
  compareValid
} from '@/types/ParameterType'
import { ElLoading, ElMessageBox, ElTable, type UploadRequestOptions } from 'element-plus'
import type { Equipment } from '@/types/EquipmentType'
import { useParameterEditSId } from '@/stores/parameterEditSId'
import type { ParaStandard } from '@/types/StandardType'

const route = useRoute()
const router = useRouter()
const standardId = useParameterEditSId()

function goBack() {
  router.push('/home/processingT')
}

function fAlert(message: string) {
  ElMessageBox.alert(message, '错误', {
    cancelButtonText: '确认'
  })
}

const parameter = ref<Parameter>({
  name: '',
  emps: [],
  humanList: [],
  equipmentList: [],
  sample: {
    informationFile: '',
    photo: '',
    followStandard: true
  },
  sop: {
    file: '',
    followStandard: true
  },
  facilityList: [],
  compareValidList: [],
  simulation: {
    report: '',
    origin: '',
    followStandard: true
  },
  status: 'Uncompleted',
  labAdmin: {
    username: '',
    type: ''
  }
})
const standardPara = ref<ParaStandard>({
  id: 0,
  sample: {
    informationFile: '',
    photo: '',
    followStandard: true
  },
  sop: {
    file: '',
    followStandard: true
  },
  simulation: {
    report: '',
    origin: '',
    followStandard: true
  }
})

onBeforeMount(() => {
  api.getParameterById(parseInt(route.params.id.toString())).then((resp) => {
    parameter.value = resp
    editHumanList.value = toEditHuman(parameter.value.humanList)
    editFacilityList.value = toEditFacility(parameter.value.facilityList)
    editCompareList.value = toEditCompare(parameter.value.compareValidList)
  })
  if (standardId.id == undefined || standardId.id == -1) {
    ElMessageBox.alert('标准ID为空，请从未完成任务界面重新进入', '错误', {
      confirmButtonText: '确认'
    }).then(() => {
      router.push('/home/ProssingT')
    })
  }
  api.getParaStandard(standardId.id).then((resp) => {
    standardPara.value = resp
  })
})
//human
const editHumanList = ref<EditHuman[]>([])

function toEditHuman(humanList: Human[]): EditHuman[] {
  let list: EditHuman[] = []
  humanList.forEach((i) => {
    let x: EditHuman = {
      id: i.id,
      edit: false,
      information: i.information,
      trainFile: i.trainFile,
      examineFile: i.examineFile,
      authorizationFile: i.authorizationFile
    }
    list.push(x)
  })
  return list
}

const addHuman = () => {
  let x: EditHuman = {
    information: '',
    trainFile: '',
    examineFile: '',
    authorizationFile: '',
    edit: true
  }
  editHumanList.value.push(x)
}

function humanValid(x: EditHuman) {
  if (x.information == '') {
    fAlert('请填写姓名！')
  } else if (x.trainFile == '') {
    fAlert('请上传训练情况文件！')
  } else if (x.examineFile == '') {
    fAlert('请上传考核资料文件！')
  } else if (x.authorizationFile == '') {
    fAlert('请上传授权批准文件！')
  } else {
    x.edit = false
  }
}
//设施
const editFacilityList = ref<EditFacility[]>([])

function toEditFacility(facilitylist: Facility[]): EditFacility[] {
  let list: EditFacility[] = []
  facilitylist.forEach((i) => {
    let x: EditFacility = {
      id: i.id,
      edit: false,
      name: i.name,
      file: i.file
    }
    list.push(x)
  })
  return list
}

const addFacility = () => {
  let x: EditFacility = {
    edit: true,
    name: '',
    file: ''
  }
  editFacilityList.value.push(x)
}

function facilityValid(x: EditFacility) {
  if (x.name == '') {
    fAlert('请填写要求名称！')
  } else if (x.file == '') {
    fAlert('请上传证明文件！')
  } else {
    x.edit = false
  }
}
//compareValid
const editCompareList = ref<EditCompare[]>([])

function toEditCompare(comparelist: compareValid[]): EditCompare[] {
  let list: EditCompare[] = []
  comparelist.forEach((i) => {
    let x: EditCompare = {
      id: i.id,
      edit: false,
      file: i.file
    }
    list.push(x)
  })
  return list
}

const addCompare = () => {
  let x: EditCompare = {
    edit: true,
    file: ''
  }
  editCompareList.value.push(x)
}

function compareValidValid(x: EditCompare) {
  if (x.file == '') {
    fAlert('请上传比对/验证结果！')
  } else {
    x.edit = false
  }
}
//sample
const sampleEdit = ref(false)

//SOP
const sopEdit = ref(false)

//simulation
const simulationEdit = ref(false)

//设备选择相关
const equipmentList = ref<Equipment[]>([])
const equipmentTableRef = ref<InstanceType<typeof ElTable>>()

onBeforeMount(() => {
  api.getAllEquipment().then((resp) => {
    equipmentList.value = resp
  })
})

const chooseDialogVisible = ref(false)

function chooseEquipment() {
  chooseDialogVisible.value = true
  let selectRow: any[] = []
  parameter.value.equipmentList.forEach((x) => {
    selectRow.push(
      equipmentList.value.find((y) => {
        return y.id == x.id
      })
    )
  })
  nextTick(() => {
    equipmentTableRef.value?.clearSelection()
    selectRow.forEach((row) => {
      equipmentTableRef.value!.toggleRowSelection(row, true)
    })
  })
}

const handleSelectionChange = (val: Equipment[]) => {
  parameter.value.equipmentList.splice(0, parameter.value.equipmentList.length)
  for (let x of val) {
    parameter.value.equipmentList.push(x)
  }
}

function confirmEmps() {
  chooseDialogVisible.value = false
}

//其他函数
function toFile(x: string) {
  window.open(api_url + 'files/' + x)
}

async function uploadFile(params: UploadRequestOptions) {
  let data = new FormData()
  let uuid = ''
  data.append('file', params.file)
  await api.upload(data).then((resp) => {
    uuid = resp
  })
  return uuid
}

function deleteIn(list: any[], index: number) {
  list.splice(index, 1)
}

function changeStatus() {
  let loading = ElLoading.service()
  api.changeStatus(parameter.value.id).then(() => {
    ElMessageBox.alert('该任务已标记完成', '成功', {
      confirmButtonText: '确认'
    }).then(() => {
      loading.close()
      router.push('/home/ProcessingT')
    })
  })
}

function submit() {
  let loading = ElLoading.service()
  parameter.value.compareValidList = editCompareList.value
  parameter.value.facilityList = editFacilityList.value
  parameter.value.humanList = editHumanList.value
  api.submitParameter(parameter.value, standardPara.value).then(() => {
    loading.close()
    ElMessageBox.alert('修改成功', '成功', {
      confirmButtonText: '确认'
    }).then(() => {
      router.go(0)
    })
  })
}
</script>

<template>
  <div class="main">
    <h2 class="h2">查看项目</h2>
    <div class="info_main">
      <el-container>
        <el-header>
          <div class="sub">
            <el-page-header @back="goBack()">
              <template #content>
                <span class="text-large font-600 mr-3"> 编辑 </span>
              </template>
            </el-page-header>
          </div>
        </el-header>
        <el-container>
          <el-main>
            <div class="submainbox">
              <div class="ry">
                <div class="title_sub">
                  <span class="text_sub"> 人员 </span>
                </div>
                <el-table :data="editHumanList">
                  <el-table-column type="index"></el-table-column>
                  <el-table-column label="姓名">
                    <template #default="scope">
                      <span v-if="!scope.row.edit">{{ scope.row.information }}</span>
                      <el-input v-else v-model="scope.row.information" placeholder=""></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="培训情况">
                    <template #default="scope">
                      <el-upload
                        :limit="1"
                        ref="upload"
                        :show-file-list="false"
                        :http-request="
                          (params: UploadRequestOptions) => {
                            uploadFile(params).then((resp) => {
                              scope.row.trainFile = resp
                            })
                          }
                        "
                      >
                        <template v-if="scope.row.edit" #trigger>
                          <el-button type="primary">选择文件</el-button>
                        </template>
                        <template v-if="scope.row.trainFile != ''" #tip>
                          <el-link @click="toFile(scope.row.trainFile)">{{
                            scope.row.trainFile
                          }}</el-link>
                        </template>
                      </el-upload>
                    </template>
                  </el-table-column>
                  <el-table-column label="考核资料">
                    <template #default="scope">
                      <el-upload
                        :limit="1"
                        ref="upload"
                        :show-file-list="false"
                        :http-request="
                          (params: UploadRequestOptions) => {
                            uploadFile(params).then((resp) => {
                              scope.row.examineFile = resp
                            })
                          }
                        "
                      >
                        <template v-if="scope.row.edit" #trigger>
                          <el-button type="primary">选择文件</el-button>
                        </template>
                        <template v-if="scope.row.examineFile != ''" #tip>
                          <el-link @click="toFile(scope.row.examineFile)">{{
                            scope.row.examineFile
                          }}</el-link>
                        </template>
                      </el-upload>
                    </template>
                  </el-table-column>
                  <el-table-column label="授权批准">
                    <template #default="scope">
                      <el-upload
                        :limit="1"
                        ref="upload"
                        :show-file-list="false"
                        :http-request="
                          (params: UploadRequestOptions) => {
                            uploadFile(params).then((resp) => {
                              scope.row.authorizationFile = resp
                            })
                          }
                        "
                      >
                        <template v-if="scope.row.edit" #trigger>
                          <el-button type="primary">选择文件</el-button>
                        </template>
                        <template v-if="scope.row.authorizationFile != ''" #tip>
                          <el-link @click="toFile(scope.row.authorizationFile)">{{
                            scope.row.authorizationFile
                          }}</el-link>
                        </template>
                      </el-upload>
                    </template>
                  </el-table-column>
                  <el-table-column label="">
                    <template #default="scope">
                      <el-button
                        type="primary"
                        v-if="scope.row.edit == false"
                        @click="scope.row.edit = true"
                        >编辑</el-button
                      >
                      <div v-else>
                        <el-button type="success" @click="humanValid(scope.row)"
                          ><el-icon> <Check /> </el-icon
                        ></el-button>
                        <el-button type="danger" @click="deleteIn(editHumanList, scope.$index)"
                          ><el-icon> <Delete /> </el-icon
                        ></el-button>
                      </div> </template
                  ></el-table-column>
                </el-table>
                <el-button type="primary" @click="addHuman">添加</el-button>
              </div>
              <div class="sb">
                <div class="title_sub">
                  <span class="text_sub"> 设备 </span>
                </div>
                <el-table :data="parameter.equipmentList">
                  <el-table-column type="index"></el-table-column>
                  <el-table-column label="设备仪器编号" prop="equipNo"></el-table-column>
                  <el-table-column label="名称" prop="name"></el-table-column>
                  <el-table-column label="型号/规格/等级" prop="level"></el-table-column>
                  <el-table-column label="测量范围" prop="scope"></el-table-column>
                  <el-table-column label="设备购买年份" prop="addYear"></el-table-column>
                  <el-table-column label="溯源方式" prop="traceMethod"></el-table-column>
                  <el-table-column label="有效期截止至"></el-table-column>
                  <el-table-column label="设备来源" prop="source"></el-table-column>
                </el-table>
                <el-button type="primary" @click="chooseEquipment()">选择设备</el-button>
              </div>
              <div class="yp">
                <div class="title_sub">
                  <span class="text_sub"> 样品 </span>
                </div>
                <div class="form_yp">
                  <div v-if="parameter.sample.followStandard">当前为该标准通用样品</div>
                  <div v-else>当前为本参数专用样品</div>
                  <div style="display: flex">
                    <div>样品信息一览表：</div>
                    <el-upload
                      :limit="1"
                      ref="upload"
                      :show-file-list="false"
                      :http-request="
                        (params: UploadRequestOptions) => {
                          if (parameter.sample.followStandard) {
                            uploadFile(params).then((resp) => {
                              standardPara.sample.informationFile = resp
                            })
                          } else {
                            uploadFile(params).then((resp) => {
                              parameter.sample.informationFile = resp
                            })
                          }
                        }
                      "
                    >
                      <template v-if="sampleEdit" #trigger>
                        <el-button type="primary">选择文件</el-button>
                      </template>
                      <template
                        v-if="
                          parameter.sample.informationFile != '' && !parameter.sample.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(parameter.sample.informationFile)">{{
                          parameter.sample.informationFile
                        }}</el-link>
                      </template>
                      <template
                        v-else-if="
                          standardPara.sample.informationFile != '' &&
                          parameter.sample.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(standardPara.sample.informationFile)">{{
                          standardPara.sample.informationFile
                        }}</el-link>
                      </template>
                      <template v-else #tip> 无文件 </template>
                    </el-upload>
                  </div>
                  <div style="display: flex">
                    <div>样品照片：</div>
                    <el-upload
                      :limit="1"
                      ref="upload"
                      :show-file-list="false"
                      :http-request="
                        (params: UploadRequestOptions) => {
                          if (parameter.sample.followStandard) {
                            uploadFile(params).then((resp) => {
                              standardPara.sample.photo = resp
                            })
                          } else {
                            uploadFile(params).then((resp) => {
                              parameter.sample.photo = resp
                            })
                          }
                        }
                      "
                    >
                      <template v-if="sampleEdit" #trigger>
                        <el-button type="primary">选择文件</el-button>
                      </template>
                      <template
                        v-if="parameter.sample.photo != '' && !parameter.sample.followStandard"
                        #tip
                      >
                        <el-link @click="toFile(parameter.sample.photo)">{{
                          parameter.sample.photo
                        }}</el-link>
                      </template>
                      <template
                        v-else-if="
                          standardPara.sample.photo != '' && parameter.sample.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(standardPara.sample.photo)">{{
                          standardPara.sample.photo
                        }}</el-link>
                      </template>
                      <template v-else #tip> 无文件 </template>
                    </el-upload>
                  </div>
                  <el-button type="primary" v-if="sampleEdit == false" @click="sampleEdit = true"
                    >编辑</el-button
                  >
                  <el-button v-else type="success" @click="sampleEdit = false"
                    ><el-icon>
                      <Check />
                    </el-icon>
                  </el-button>
                  <el-button
                    type="primary"
                    v-if="parameter.sample.followStandard"
                    @click="parameter.sample.followStandard = false"
                    >使用该参数专用样品</el-button
                  >
                  <el-button type="primary" v-else @click="parameter.sample.followStandard = true"
                    >使用标准通用样品</el-button
                  >
                </div>
              </div>
              <div class="sop">
                <div class="title_sub">
                  <span class="text_sub"> 检验细则(SOP) </span>
                </div>
                <div class="form_sop">
                  <div v-if="parameter.sop.followStandard">当前为该标准通用SOP</div>
                  <div v-else>当前为本参数专用SOP</div>
                  <div style="display: flex">
                    <div>检验细则：</div>
                    <el-upload
                      :limit="1"
                      ref="upload"
                      :show-file-list="false"
                      :http-request="
                        (params: UploadRequestOptions) => {
                          if (parameter.sop.followStandard) {
                            uploadFile(params).then((resp) => {
                              standardPara.sop.file = resp
                            })
                          } else {
                            uploadFile(params).then((resp) => {
                              parameter.sop.file = resp
                            })
                          }
                        }
                      "
                    >
                      <template v-if="sopEdit" #trigger>
                        <el-button type="primary">选择文件</el-button>
                      </template>
                      <template
                        v-if="parameter.sop.file != '' && !parameter.sop.followStandard"
                        #tip
                      >
                        <el-link @click="toFile(parameter.sop.file)">{{
                          parameter.sop.file
                        }}</el-link>
                      </template>
                      <template
                        v-else-if="standardPara.sop.file != '' && parameter.sop.followStandard"
                        #tip
                      >
                        <el-link @click="toFile(standardPara.sop.file)">{{
                          standardPara.sop.file
                        }}</el-link>
                      </template>
                      <template v-else #tip> 无文件 </template>
                    </el-upload>
                  </div>
                  <el-button type="primary" v-if="sopEdit == false" @click="sopEdit = true"
                    >编辑</el-button
                  >
                  <el-button v-else type="success" @click="sopEdit = false"
                    ><el-icon>
                      <Check />
                    </el-icon>
                  </el-button>
                  <el-button
                    type="primary"
                    v-if="parameter.sop.followStandard"
                    @click="parameter.sop.followStandard = false"
                    >使用该参数专用样品</el-button
                  >
                  <el-button type="primary" v-else @click="parameter.sop.followStandard = true"
                    >使用标准通用样品</el-button
                  >
                </div>
              </div>
              <div class="ss">
                <div class="title_sub">
                  <span class="text_sub"> 设施 </span>
                </div>
                <el-table v-if="editFacilityList.length != 0" :data="editFacilityList">
                  <el-table-column type="index"></el-table-column>
                  <el-table-column label="要求名称">
                    <template #default="scope">
                      <span v-if="!scope.row.edit">{{ scope.row.name }}</span>
                      <el-input v-else v-model="scope.row.name" placeholder=""></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="证明文件">
                    <template #default="scope">
                      <el-upload
                        :limit="1"
                        ref="upload"
                        :show-file-list="false"
                        :http-request="
                          (params: UploadRequestOptions) => {
                            uploadFile(params).then((resp) => {
                              scope.row.file = resp
                            })
                          }
                        "
                      >
                        <template v-if="scope.row.edit" #trigger>
                          <el-button type="primary">选择文件</el-button>
                        </template>
                        <template v-if="scope.row.file != ''" #tip>
                          <el-link @click="toFile(scope.row.file)">{{ scope.row.file }}</el-link>
                        </template>
                      </el-upload>
                    </template>
                  </el-table-column>
                  <el-table-column label="">
                    <template #default="scope">
                      <el-button
                        type="primary"
                        v-if="scope.row.edit == false"
                        @click="scope.row.edit = true"
                        >编辑</el-button
                      >
                      <div v-else>
                        <el-button type="success" @click="facilityValid(scope.row)"
                          ><el-icon> <Check /> </el-icon
                        ></el-button>
                        <el-button type="danger" @click="deleteIn(editFacilityList, scope.$index)"
                          ><el-icon> <Delete /> </el-icon
                        ></el-button>
                      </div> </template
                  ></el-table-column>
                </el-table>
                <div v-else>无特殊要求</div>
                <el-button type="primary" @click="addFacility">添加</el-button>
              </div>
              <div class="yz">
                <div class="title_sub">
                  <span class="text_sub"> 比对验证 </span>
                </div>
                <el-table v-if="editCompareList.length != 0" :data="editCompareList">
                  <el-table-column type="index"></el-table-column>
                  <el-table-column label="比对/验证结果">
                    <template #default="scope">
                      <el-upload
                        :limit="1"
                        ref="upload"
                        :show-file-list="false"
                        :http-request="
                          (params: UploadRequestOptions) => {
                            uploadFile(params).then((resp) => {
                              scope.row.file = resp
                            })
                          }
                        "
                      >
                        <template v-if="scope.row.edit" #trigger>
                          <el-button type="primary">选择文件</el-button>
                        </template>
                        <template v-if="scope.row.file != ''" #tip>
                          <el-link @click="toFile(scope.row.file)">{{ scope.row.file }}</el-link>
                        </template>
                      </el-upload>
                    </template>
                  </el-table-column>
                  <el-table-column label="">
                    <template #default="scope">
                      <el-button
                        type="primary"
                        v-if="scope.row.edit == false"
                        @click="scope.row.edit = true"
                        >编辑</el-button
                      >
                      <div v-else>
                        <el-button type="success" @click="compareValidValid(scope.row)"
                          ><el-icon> <Check /> </el-icon
                        ></el-button>
                        <el-button type="danger" @click="deleteIn(editCompareList, scope.$index)"
                          ><el-icon> <Delete /> </el-icon
                        ></el-button>
                      </div> </template
                  ></el-table-column>
                </el-table>
                <div v-else>无特殊要求</div>
                <el-button type="primary" @click="addCompare">添加</el-button>
              </div>
              <div class="sy">
                <div class="title_sub">
                  <span class="text_sub"> 模拟实验 </span>
                </div>
                <div class="form_sy">
                  <div v-if="parameter.simulation.followStandard">当前为该标准通用模拟实验</div>
                  <div v-else>当前为本参数专用模拟实验</div>
                  <div style="display: flex">
                    <div>模拟实验报告：</div>
                    <el-upload
                      :limit="1"
                      ref="upload"
                      :show-file-list="false"
                      :http-request="
                        (params: UploadRequestOptions) => {
                          if (parameter.simulation.followStandard) {
                            uploadFile(params).then((resp) => {
                              standardPara.simulation.report = resp
                            })
                          } else {
                            uploadFile(params).then((resp) => {
                              parameter.simulation.report = resp
                            })
                          }
                        }
                      "
                    >
                      <template v-if="simulationEdit" #trigger>
                        <el-button type="primary">选择文件</el-button>
                      </template>
                      <template
                        v-if="
                          parameter.simulation.report != '' && !parameter.simulation.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(parameter.simulation.report)">{{
                          parameter.simulation.report
                        }}</el-link>
                      </template>
                      <template
                        v-else-if="
                          standardPara.simulation.report != '' &&
                          parameter.simulation.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(standardPara.simulation.report)">{{
                          standardPara.simulation.report
                        }}</el-link>
                      </template>
                      <template v-else #tip> 无文件 </template>
                    </el-upload>
                  </div>
                  <div style="display: flex">
                    <div>原始记录：</div>
                    <el-upload
                      :limit="1"
                      ref="upload"
                      :show-file-list="false"
                      :http-request="
                        (params: UploadRequestOptions) => {
                          if (parameter.simulation.followStandard) {
                            uploadFile(params).then((resp) => {
                              standardPara.simulation.origin = resp
                            })
                          } else {
                            uploadFile(params).then((resp) => {
                              parameter.simulation.origin = resp
                            })
                          }
                        }
                      "
                    >
                      <template v-if="simulationEdit" #trigger>
                        <el-button type="primary">选择文件</el-button>
                      </template>
                      <template
                        v-if="
                          parameter.simulation.origin != '' && !parameter.simulation.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(parameter.simulation.origin)">{{
                          parameter.simulation.origin
                        }}</el-link>
                      </template>
                      <template
                        v-else-if="
                          standardPara.simulation.origin != '' &&
                          parameter.simulation.followStandard
                        "
                        #tip
                      >
                        <el-link @click="toFile(standardPara.simulation.origin)">{{
                          standardPara.simulation.origin
                        }}</el-link>
                      </template>
                      <template v-else #tip> 无文件 </template>
                    </el-upload>
                  </div>
                  <el-button
                    type="primary"
                    v-if="simulationEdit == false"
                    @click="simulationEdit = true"
                    style="margin-top: 10px"
                    >编辑</el-button
                  >
                  <el-button v-else type="success" @click="simulationEdit = false"
                    ><el-icon>
                      <Check />
                    </el-icon>
                  </el-button>
                  <el-button
                    type="primary"
                    v-if="parameter.simulation.followStandard"
                    @click="parameter.simulation.followStandard = false"
                    style="margin-top: 10px"
                    >使用该参数专用样品</el-button
                  >
                  <el-button
                    type="primary"
                    v-else
                    @click="parameter.simulation.followStandard = true"
                    >使用标准通用样品</el-button
                  >
                </div>
              </div>
            </div>
          </el-main>
        </el-container>
      </el-container>
      <el-button type="primary" @click="submit()" style="float: right; margin-right: 30px"
        >提交更改</el-button
      >
      <el-button type="primary" @click="changeStatus()" style="float: right; margin-right: 30px"
        >标记该任务已完成</el-button
      >
    </div>

    <el-dialog v-model="chooseDialogVisible" title="选择员工">
      <el-table
        :data="equipmentList"
        @selection-change="handleSelectionChange"
        ref="equipmentTableRef"
      >
        <el-table-column type="index"></el-table-column>
        <el-table-column label="设备仪器编号" prop="equipNo"></el-table-column>
        <el-table-column label="名称" prop="name"></el-table-column>
        <el-table-column label="型号/规格/等级" prop="level"></el-table-column>
        <el-table-column label="测量范围" prop="scope"></el-table-column>
        <el-table-column label="设备购买年份" prop="addYear"></el-table-column>
        <el-table-column label="溯源方式" prop="traceMethod"></el-table-column>
        <el-table-column label="有效期截止至"></el-table-column>
        <el-table-column label="设备来源" prop="source"></el-table-column>
        <el-table-column type="selection"></el-table-column>
      </el-table>
      <template #footer>
        <el-button type="primary" @click="confirmEmps()">确定</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<style scoped>
.main {
  margin-bottom: 160px;
}
.h2 {
  margin-left: 50px;
  margin-top: 20px;
}
.info_main {
  width: 88%;
  height: 670px;
  border-width: 5px;
  margin-top: 30px;
  margin-left: 50px;
  padding-bottom: 50px;
  box-shadow: 0px 0px 8px 1px lightgray;
  padding-top: 10px;
  transition: 1s;
}

.sub {
  border-style: inset;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  padding-bottom: 10px;
}

.submainbox {
  margin-left: 30px;
  margin-right: 30px;
  height: 550px;
  overflow-y: auto;
}

.title_sub {
  border-style: inset;
  border-color: black;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  padding-bottom: 10px;
  margin-right: 50px;
  margin-bottom: 10px;
  margin-top: 10px;
}
.text_sub {
  font-size: 24px;
  font-weight: 800;
}
.ry {
  margin-bottom: 40px;
}
.sb {
  margin-bottom: 40px;
}
.yp {
  margin-bottom: 40px;
}
.sop {
  margin-bottom: 40px;
}
.sy {
  margin-bottom: 40px;
}
.ss {
  margin-bottom: 40px;
}
.yz {
  margin-bottom: 40px;
}
</style>
